﻿<DataGrid x:Class="RandomFileCopier.Controls.CopyDataGrid"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
            xmlns:local="clr-namespace:RandomFileCopier"
            xmlns:control="clr-namespace:RandomFileCopier.Controls"
            xmlns:resx="clr-namespace:RandomFileCopier.Properties"
            mc:Ignorable="d" 
            d:DesignHeight="300" d:DesignWidth="300"
            AutoGenerateColumns="False" 
            CanUserReorderColumns="True" 
            CanUserSortColumns="True"
            CanUserResizeColumns="True" 
            CanUserResizeRows="False" 
            xmlns:bindingProxy="clr-namespace:RandomFileCopier.Helpers"
            SelectionMode="Single"
            SelectedItem="{Binding SelectedItem}"
          >
    <DataGrid.Resources>
        <bindingProxy:BindingProxy x:Key="proxy" Data="{Binding}"/>
    </DataGrid.Resources>
    <DataGrid.ContextMenu>
        <ContextMenu>
            <MenuItem Header="{x:Static resx:Resources.OpenFolder}" Command="{Binding Data.OpenFolderCommand, Source={StaticResource proxy}}">
                <MenuItem.Icon>
                    <Image Source="../Images/folder.ico"/>
                </MenuItem.Icon>
            </MenuItem>
        </ContextMenu>
    </DataGrid.ContextMenu>
<DataGrid.Columns>
        <DataGridTemplateColumn SortMemberPath="IsSelected"  x:Name="SelectedColumn"  Header="{x:Static resx:Resources.IsSelected}">
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <CheckBox Command="{Binding Data.SelectionClicked, Source={StaticResource proxy}}" HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding Path=IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>
        <DataGridTextColumn x:Name="FileNameColumn" IsReadOnly="True" Width="20*" Binding="{Binding Name}" Header="{x:Static resx:Resources.Name}" />
        <DataGridTextColumn x:Name="PathColumn" IsReadOnly="True" Width="25*" Binding="{Binding Path}" Header="{x:Static resx:Resources.Path}"/>
    </DataGrid.Columns>
</DataGrid>
